#pragma once

#include <string>
#include <fstream>
#include <time.h>


using namespace std;

enum LOGLEVEL
{
	None,
	Error,
	Warning,
	Information,
	Verbose
};

const string levelStrings[] = { "None", "Error", "Warning", "Information", "Verbose" };

class FileLog
{
public:
	FileLog(void);
public:
	~FileLog(void);
public:
	// Write Log Entry
	void WriteLog(LOGLEVEL LogLevel, const string& Method, const string& IP, const string& Body, const string& Request, const string& Message);
protected:
	string filename;
	string logFolder;
	unsigned int entryID;
	unsigned int files2Keep;
	unsigned int seconds2Keep;
	ofstream fs;
	string GetFileLogName(); 
	time_t fileTime;
	LOGLEVEL minLogLevel;

public:
	void SetFolder(const string& Folder);
	void NewId();
	void SetMinLogLevel(LOGLEVEL MinLogLevel);
public:
	// Enter file base name (e.g. "mylog")
	void SetFileBaseName(const string& FileBaseName);
};
